//2009/08/22 21:22:24
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <sstream>
#include <algorithm>

using namespace std;

class DocumentSearch
{
public:
    int nonIntersecting(vector <string> doc, string search)
    {
        int ret = -1;
        string s;
        for (int i=0; i<doc.size(); i++) s += doc[i];
        int cnt = 0;
        for (int j=0; j<s.size();)
        {
            cout << "j: " << j << endl;
            size_t pos = s.substr(j).find(search);
            cout << "pos: " << pos << endl;
			// pos: 4294967295;
            if (pos == string::npos) break;
            else
            {
                j += pos + search.size();
                cnt++;
            }
        }
        if (ret < cnt || ret == -1)
            ret = cnt;
        return ret;
    }
};
